package com.qf.controller;

import com.qf.pojo.Goods;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

@RestController
public class GoodsController {


    @Value("${server.port}")
    private Integer port;

    @RequestMapping("/query/{id}")
    public String query(@PathVariable("id") Integer id) {
        System.out.println(1/id);
        return "查询商品信息! -- " + port + "::::" + Math.random();
    }

    @GetMapping("/findById")
    public String findById(Integer id) {
        System.out.println("id:" + id);
        return "根据id查询商品信息! -- " + id;
    }

    @GetMapping("/{id}")
    public String findDetails(@PathVariable("id") Integer id) {
        System.out.println("id:" + id);
        return "根据id查询商品信息! -- " + id;
    }

    @PostMapping("/save")
    public String save(@RequestBody Goods goods) {
        System.out.println("goods:" + goods);
        return "根据id查询商品信息! -- " + goods;
    }

}